package com.java.learn;

public class StringDemo {
    public static void main(String[] args) {
        String s = new String();
        System.out.println(s);
        char[] c = {'a', 'b', 'c'};
        String s1 = new String(c);
        System.out.println(s1);
        byte[] b = {97, 98, 99};
        String s2 = new String(b);
        System.out.println(s2);

        String a = "abc";
        String bs = "ab";
        String cs = bs + "c";//构建StringBuidler后转为String
        System.out.println(bs == cs);

        String a2 = "abc";
        String cs2 = "a" + "b" + "c";
        System.out.println(a2 == cs2);//常量池优化
    }
}
